#ifndef		__serial
#define		__serial



#define PORT_COM1	0x3f8
#define PORT_COM2	0x2f8
#define PORT_COM3	0x3e8
#define PORT_COM4	0x2e8

#define REG_RHR         0
#define REG_THR         0
#define REG_IER         1
#define REG_IIR         2
#define REG_LCR         3
#define REG_MCR         4
#define REG_LSR         5
#define REG_MSR         6
#define REG_SCRATCH     7

//LCR-related constants
#define PARITY_NONE     0
#define PARITY_ODD      8
#define PARITY_EVEN     24
#define PARITY_MARK     20
#define PARITY_SPACE    28

#define STOP_ONE        0
#define STOP_TWO        4

#define BITS_5          0
#define BITS_6          1
#define BITS_7          2
#define BITS_8          3

#define DLR_ON          128


void serial_write (int comPort, unsigned char ch);
unsigned char simple_serial_read(int comPort);
int read_UART(int comPort, int reg);
void write_UART(int comPort, int reg, int data);
int setup_serial(int comPort, int baud, unsigned char misc);

#endif
 
